package cn.itcast.service.impl;


import cn.itcast.dao.OrderDao;
import cn.itcast.dao.PayDao;
import cn.itcast.service.OrderService;
import cn.itcast.service.PayService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * 预约支付查询
 */
@Service(interfaceClass = PayService.class)
public class PayServiceImpl implements PayService {
    @Autowired
    private PayDao payDao;

    @Override
    public List<Integer> findPayCountByMonths(List<String> months) {
        List<Integer> PayCount = new ArrayList<>();
        for (String month : months) {
            String startDate = month + ".01";
            String endDate = month + ".31";
            Integer count = payDao.findPayBeforeDate(startDate,endDate);
            PayCount.add(count);
        }
        return PayCount;
    }
}
